﻿using System;
using WeifenLuo.WinFormsUI.Docking;
using System.Windows.Forms;

namespace Zove.Desktop.Tools
{
    public partial class EmbeddedWebBrowser : DockContent
    {
        public EmbeddedWebBrowser()
        {
            InitializeComponent();
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {

        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            this.webBrowser1.GoBack();
        }

        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            this.webBrowser1.GoForward();
        }

        private void toolStripButton4_Click(object sender, EventArgs e)
        {
            this.webBrowser1.GoHome();
        }

        private void toolStripButton1_Click_1(object sender, EventArgs e)
        {
            this.webBrowser1.Navigate(this.tslUrl.Text);
            this.webBrowser1.DocumentCompleted 
                += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
        }

        public void webBrowser1_DocumentCompleted(
            object sender, WebBrowserDocumentCompletedEventArgs args)
        {
            this.Text = this.webBrowser1.Document.Title;
        }
    }
}
